package br.mestrado.unb.bs.model.sensor;

import br.mestrado.unb.bs.model.constant.DataPackageConstant;
import br.mestrado.unb.bs.model.field.TemperatureInterface;

/**
 * Models temperature data package payload
 * Must be wrapped by a DataPackage object 
 * @author paula
 */
public class TemperaturePayload  extends Payload implements TemperatureInterface{

	byte lowTemperature;
	byte highTemperature;
	
	
	public TemperaturePayload() {
		this.lowTemperature = (byte)0;
		this.highTemperature= (byte)0;
	}
	
	/**
	 * Constructor
	 * @param low
	 * @param high
	 */
	public TemperaturePayload(byte low, byte high) {
		this.lowTemperature = low;
		this.highTemperature= high;
	}
	
	@Override
	public byte[] toByteStream() {
		byte[] stream = new byte[getSize()];
		stream[0] = lowTemperature;
		stream[1] = highTemperature;
		return stream;
	}

	@Override
	public byte getSize() {
		return DataPackageConstant.temp_payload_size;
	}
	@Override
	public byte getCategory() {
		return DataPackageConstant.temp_category;
	}

	public byte getLowTemperature() {
		return lowTemperature;
	}

	public void setLowTemperature(byte lowTemperature) {
		this.lowTemperature = lowTemperature;
	}

	public byte getHighTemperature() {
		return highTemperature;
	}

	public void setHighTemperature(byte highTemperature) {
		this.highTemperature = highTemperature;
	}

	@Override
	public String toString() {
		return "TemperaturePayload [lowTemperature=" + lowTemperature
				+ ", highTemperature=" + highTemperature + "]";
	}


}
